package com.founder.devwork.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.founder.devwork.dto.req.CommitLogQueryDTO;
import com.founder.devwork.dto.res.CommitLogDTO;
import com.founder.devwork.service.CommitLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * CommitLogController 用于处理与提交日志相关的请求。
 * 提供分页查询提交日志功能。
 */
@RestController
@RequestMapping("/api/commit-log")
public class CommitLogController {

    @Autowired
    private CommitLogService commitLogService;

    /**
     * 分页查询提交日志。
     * @param pageNum 页码
     * @param pageSize 每页条数
     * @param query 查询条件
     * @return 分页结果
     */
    @GetMapping("/page")
    public Page<CommitLogDTO> page(@RequestParam(defaultValue = "1") int pageNum, @RequestParam(defaultValue = "10") int pageSize, CommitLogQueryDTO query) {
        return commitLogService.pageCommitLogsWithQuery(pageNum, pageSize, query);
    }
}
